﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Model;
using DAL;
using System.Data.SqlClient;

namespace BLL
{
    public class DQConfigBLL : BaseBLL
    {
        public DQConfigBLL(LoginInfo info)
        {
            loginInfo = info;
        }
        public int Update(DQConfigTransData data)
        {
            DQConfigDAL dal = new DQConfigDAL(loginInfo);
            return dal.Update(data);
        }

        public int Delete(string id)
        {
            DQConfigDAL dal = new DQConfigDAL(loginInfo);
            return dal.Delete(id);
        }
        public bool UpStep(IList<DQConfig> jsonList, string id)
        {
            try
            {
                DQConfigDAL dal = new DQConfigDAL(loginInfo);
                return dal.UpStep(jsonList,id);
            }
            catch (Exception ex) { throw ex; }
        }

        public string CheckDQColumn(string id)
        {
            try
            {
                DQConfigDAL dal = new DQConfigDAL(loginInfo);
                return dal.CheckDQColumn(id);
            }
            catch (Exception ex) { throw ex; }
        }
        public bool SendDQConfig(string modelid,string dbname,string nmodelid,string ndnname)
        {
            try
            {
                DQConfigDAL dal = new DQConfigDAL(loginInfo);
                return dal.SendDQConfig(modelid, dbname, nmodelid, ndnname);
            }
            catch (Exception ex) { throw ex; }
        }
        public bool DQNameIsExist(string dqName, string id, string modelID)
        {
            DQConfigDAL dal = new DQConfigDAL(loginInfo);
            return dal.DQNameIsExist(dqName, id, modelID);
        }

        public IList<DQConfig> GetList(SqlParameter[] pare, string sort, string order)
        {
            DQConfigDAL dal = new DQConfigDAL(loginInfo);
            return dal.GetList(pare, sort, order);
        }
        public DQRulesConfig GetRoleList(string id)
        {
            DQConfigDAL dal = new DQConfigDAL(loginInfo);
            return dal.GetRoleList(id);
        }
        public int GetListCount(string schemaName, string tableName)
        {
            DQConfigDAL dal = new DQConfigDAL(loginInfo);
            return dal.GetListCount(schemaName, tableName);
        }

        public DQConfig GetItem(string id)
        {
            DQConfigDAL dal = new DQConfigDAL(loginInfo);
            return dal.GetItem(id);
        }

        public int GetDQConfigCount(string tableName)
        {
            DQConfigDAL dal = new DQConfigDAL(loginInfo);
            return dal.GetDQConfigCount(tableName);
        }

        public IList<string> GetStgTabList(string tableName)
        {
            DQConfigDAL dal = new DQConfigDAL(loginInfo);
            return dal.GetStgTabList(tableName);
        }
    }
}
